<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
	xmlns:t="https://code.google.com/p/rad-framework/taglib"
	xmlns:tt="https://code.google.com/p/rad-framework"
	xmlns:s="http://jboss.com/products/seam/taglib">

	<rich:simpleTogglePanel id="treeTP" switchType="client" label="#{messages['Tree']}"
		style="width:192px">
		<f:facet name="openMarker">
			<h:graphicImage value="/themes/default/images/rich-panel-header-max.gif"/>
		</f:facet>
		<f:facet name="closeMarker">
			<h:graphicImage value="/themes/default/images/rich-panel-header-min.gif"/>
		</f:facet>

		<a4j:region>
			<rich:tree id="tree" value="#{tree}" var="item"
				nodeFace="#{item.type}"
				switchType="client" 
				style="width:100%;height:150px">
				
				<rich:treeNode type="Root">
					<h:outputText value="#{item.text}"/>
				</rich:treeNode>
				
				<rich:treeNode type="Folder"
					icon="/themes/default#{item.icon}" 
					iconLeaf="/themes/default#{item.icon}">
					<h:outputText value="#{item.text}"/>
				</rich:treeNode>
						
				<c:forEach items="#{rad.framework.entityPersistenceContextMap.entityNames}" var="name">
		        	
					<rich:treeNode type="#{name.substring(name.lastIndexOf('.')+1)}" 
						icon="/themes/default#{item.icon}" 
						iconLeaf="/themes/default#{item.icon}">
					
						<s:link 
							includePageParams="false"
							view="#{item.viewId}">
							<f:param name="id" value="#{item.key}"/>
							<h:outputText value="#{item.text}"/>
						</s:link>					
					</rich:treeNode>
				</c:forEach>
						
			</rich:tree>
		</a4j:region>
	</rich:simpleTogglePanel>
</ui:composition>
